import { HttpPost, HttpGet } from '@/api/index.js'

/**
 * 新增字典
 * @param dict
 */
export const add = (dict) => {
    return HttpPost('/admin/system/dict/add', dict)
}

/**
 * 根据ID删除字典
 * @param id
 */
export const deleteById = (id) => {
    return HttpPost('/admin/system/dict/deleteById/' + id)
}

/**
 * 更新字典
 * @param dict
 */
export const edit = (dict) => {
    return HttpPost('/admin/system/dict/update', dict)
}

/**
 * 分页查询
 * @param search
 */
export const pageList = (search) => {
    return HttpGet('/admin/system/dict/listPage', search)
}

/**
 * 新增字典项
 * @param dictItem
 */
export const addItem = (dictItem) => {
    return HttpPost('/admin/system/dict/item/add', dictItem)
}

/**
 * 根据ID删除字典项目
 * @param id
 */
export const deleteItemById = (id) => {
    return HttpPost('/admin/system/dict/item/deleteById/' + id)
}

/**
 * 更新字典项
 * @param dictItem
 */
export const updateItem = (dictItem) => {
    return HttpPost('/admin/system/dict/item/update', dictItem)
}

/**
 * 字典项分页列表
 * @param search
 */
export const itemListPage = (search) => {
    return HttpGet('/admin/system/dict/item/listPage', search)
}
